<template>
	<view class="activeForm">
		<view v-show="tabId==1">
			<!-- 场景类 -->
			<view class="header">
				<radio-group @change="sceneTypeChange" >
					<label class="radio" >
						<radio value="1" :checked="1 == form.sceneType" />商用车</label>
					<label class="radio" v-show="applyDisabled">
						<radio  value="2" :checked="2 == form.sceneType" />海吉星</label>
					<label class="radio" v-show="applyDisabled">
						<radio  value="3" :checked="3 == form.sceneType" />雅斯特</label>
					<label class="radio"  >
						<radio  value="5"  :checked="5 == form.sceneType" />通用</label>		
					<label class="radio" v-show="applyDisabled">
						<radio  value="4" :checked="4 == form.sceneType" />普适</label>		
				</radio-group>
				
			</view>
			<colony @getPartnerId='putPid' :sceneType='form.sceneType' ref='colony'></colony>
			
			<commercialVehicle ref='sycars' :Pid='Pid' v-show='form.sceneType==1'></commercialVehicle>
			<haijixing v-show='form.sceneType==2'></haijixing>
			<yaste  ref='yaste'  v-show='form.sceneType==3'></yaste>
			<block v-if="isPad">
			
			</block>
			
		</view>
		<view v-show="tabId==2">
			<userInfo ref='userInfo'></userInfo>
			<userAssets ref='userAssets'></userAssets>
			<userCars></userCars>
		</view>
		<!-- 共同借款人 -->
		<view v-show="tabId==16">
			<coUserInfo @saveCache='saveCache' ref='coUserInfo'></coUserInfo>
		</view>
		<!-- 经营主体信息 -->
		<view v-show="tabId==3">
			<enterpriseInfo :sceneType='form.sceneType' :industry='industry' ref='enterpriseInfo'></enterpriseInfo>
			<enterpriseShareholder></enterpriseShareholder>
			<enterpriseCw v-if="loanType==='4'" ref='enterpriseCw'></enterpriseCw>
			<enterpriseAssets></enterpriseAssets>	
			
			
		</view>
		<view  v-show="tabId==4">
			<loanUse ref='loanUse'></loanUse>
			
			
		</view>
		<!-- <view  v-show="tabId==5">
			<manageHistory ref='manageHistory'></manageHistory>
		</view> -->
		<view  v-show="tabId==6">
			<view v-if="industry === null" class="tip" style="color: #FF9617;text-align: center;font-size: 2.8rem;">
				未选择经营行业,修改经营行业分类需跳转至经营主体信息中“经营行业”进行修改
			</view>
			<view v-else class="tip" style="color: #FF9617;text-align: center;font-size: 2.8rem;">
				修改经营行业分类需跳转至经营主体信息中“经营行业”进行修改
			</view>
			
			<wholesale ref='wholesale' :changeFlag="tabId" v-show="industry == 1||industry == 6"></wholesale>
			<manufacturing ref='manufacturing' v-show="industry == 2"></manufacturing>
			<serviceClass ref='serviceClass' v-show="industry == 3"></serviceClass>
			<logistics ref='logistics' v-show="industry == 4"></logistics>
			<building ref='building' v-show="industry == 5"></building>
			<cost v-show="industry != null"></cost>
			<block v-if="isPad">
				<!-- <jingyingImg v-show="industry != null" :changeFlag="changeFlag"></jingyingImg> -->
			</block>
			
			
		</view>
		<view v-show="tabId==7">
			<BankStatement ref='BankStatement'></BankStatement>
		</view>
		<view v-show="tabId==8">
			<view class="header">
				<radio-group @change="((o)=>{form.reportForm=o.detail.value})">
					<label class="radio">
						<radio value="1" :checked="1 == form.reportForm" />财务报表</label>
					<label class="radio">
						<radio value="2" :checked="2 == form.reportForm" />财务报表（精简）</label>
				</radio-group>
			</view>
			<financialStatements :changeFlag="tabId" ref='financial' v-show="form.reportForm==1"></financialStatements>
			<retrenchQA ref='retrenchQA' v-if="isPad" :changeFlag="tabId"  v-show="form.reportForm==2"></retrenchQA>
			<retrench :changeFlag="tabId" v-else  v-show="form.reportForm==2"></retrench>
			<mx></mx>
			
		</view>
		
		<view v-show="tabId==9">
			<affiliatedEnterprises></affiliatedEnterprises>
			
			
		</view>
		<view v-show="tabId==10">
			<relatedPersonInfor @saveCache='saveCache' ref='relatedPersonInfor' :changeFlag="tabId"></relatedPersonInfor>
			
			
		</view>
		
		<view v-show="tabId==11">
			<collateralInfo ref='coll' :changeFlag="tabId"></collateralInfo>
			
			
		</view>
		<view  v-show="tabId==12">
			<block v-if="isPad">
				<ImageData v-if="isPad" ></ImageData>
			</block>
			
		</view>
		<!-- 调查说明 -->
		<view v-show="tabId==13">
			<surveyNotes ref="SurveyNotes" ></surveyNotes>
		</view>
		
		<!-- 原借据号信息 -->
		<view v-show="tabId==14">
			<IOU></IOU>
		</view>
		<view v-show="tabId==15">
			<riskState></riskState>
			<reply></reply>
		</view>
		
	</view>
</template>

<script>
	//共同借款人
	import coUserInfo from './coBorrower/userInfo.vue'
	// =======================================
	import userInfo from './userInfo/userInfo.vue'
	import userCars from './userInfo/userCars'
	import userAssets from './userInfo/userAssets'
	import otherContacts from './userInfo/otherContacts'
	// import isHandleComVehicleMortgage from './userInfo/isHandleComVehicleMortgage'
	import enterpriseInfo from './enterprise/enterpriseInfo'
	import enterpriseAssets from './enterprise/enterpriseAssets.vue'
	import enterpriseShareholder from './enterprise/enterpriseShareholder.vue'
	import enterpriseCw from './enterprise/enterpriseCw.vue'
	import loanUse from './loanUse/loanUse.vue'
	import manageHistory from './manage/manageHistory.vue'
	import cost from './manage/cost.vue'
	import wholesale from './manage/industry/wholesale.vue'
	import manufacturing from './manage/industry/manufacturing.vue'
	import serviceClass from './manage/industry/serviceClass.vue'
	import logistics from './manage/industry/logistics.vue'
	import building from './manage/industry/building.vue'
	import financialStatements from './financialStatements/financialStatements.vue'
	import retrench from './financialStatements/retrench.vue'
	import retrenchQA from './financialStatements/retrenchQA.vue'
	import mx from './financialStatements/mx.vue'
	import commercialVehicle from './sceneClass/commercialVehicle.vue'
	import haijixing from './sceneClass/haijixing.vue'
	import yaste from './sceneClass/yaste.vue'
	import relatedPersonInfor from './relatedPersonInfor/relatedPersonInfor.vue'
	import affiliatedEnterprises from './affiliatedEnterprises/affiliatedEnterprises.vue'
	import collateralInfo from './collateralInfo/collateralInfo.vue'
	import ImageData from './imageData/imageData.vue'
	import BankStatement from './bankStatement/bankStatement.vue'
	import surveyNotes from './surveyNotes/surveyNotes.vue'
	import IOU from './IOU/IOU.vue'
	import riskState from './riskState/riskState.vue'
	// 影像上传
	import UserInfoImg from './imageData/userInfo.vue'
	import enterpriseImg from './imageData/enterprise.vue'
	import jingyingImg from './imageData/jingying.vue'
	import caiwuImg from './imageData/caiwu.vue'
	import hyImg from './imageData/hy.vue'
	import scarImg from './imageData/scar.vue'
	import fyImg from './imageData/fy.vue'
	import dbztImg from './imageData/dbzt.vue'
	import glqyImg from './imageData/glqy.vue'
	import dywImg from './imageData/dyw.vue'
	import otherImg from './imageData/other.vue'
	import reply from './imageData/reply.vue'
	import colony from './colony'
	export default{
		data(){
			return{
				loanType:'',
				Pid:'',
				applyDisabled:false,
				applyDisabled2:false,
				applyDisabled3:false,
				isPad:false,
				changeFlag:0,
				form:{
					sceneType:4,
					reportForm:null,
					industry:'1'
				},
			}
		},
		props:{
			tabId: {
			  type: String,
			  default: "1",
			},
			industry: {
			  type: String,
			  default: "1",
			},
			imgData: {
				type:Object,
				default:()=>{
					return {}
				}
			},
		},
		components:{
			coUserInfo,
			//=========
			colony,//集群
			userInfo,//客户信息
			userCars,//个人资产汽车
			userAssets,//个人资产房产
			otherContacts,//其他联系人
			// isHandleComVehicleMortgage,//是否车贷按揭
			
			enterpriseInfo, //经营主体客户信息
			enterpriseAssets,//股东构成
			enterpriseShareholder,//主要资产
			enterpriseCw,//简要财务
			loanUse,//贷款用途
			
			manageHistory,//资本积累
			cost,//费用
			
			wholesale,//批发零售类
			manufacturing,//制造类
			serviceClass,//服务类
			logistics,//物流类
			building,//建筑类
			
			financialStatements,//财务报表
			retrench,//财务报表精简
			retrenchQA,//财务报表问答
			mx,//资产明细
			
			commercialVehicle,//商用车
			haijixing,//海吉星
			yaste,//雅斯特
			relatedPersonInfor,//关联人信息,
			affiliatedEnterprises,//关联企业
			collateralInfo,//抵押物信息
			ImageData,//影像上传
			BankStatement,//银行流水
			surveyNotes,
			IOU,
			riskState,
			//影像模块
			UserInfoImg,
			enterpriseImg,
			jingyingImg,
			caiwuImg,
			hyImg,
			scarImg,
			fyImg,
			dbztImg,
			glqyImg,
			dywImg,
			otherImg,
			reply
		},
		watch:{
			imgData:{
				handler:function(res){
					//console.warn('f影像数据变化，待处理',res)
					this.changeFlag ++
				},
				deep:true
			},
			form:{
				handler:function(res){
					//console.warn('form组件数据变化',res)
					getApp().globalData.stdOffsurBaiscInfo.sceneType = res.sceneType
					getApp().globalData.stdOffsurBaiscInfo.statementType = res.reportForm
				},
				deep:true
			},
		},
		onLoad() {
			this.isPad = getApp().globalData.isPad
		},
		onShow() {
			this.industry = getApp().globalData.stdOffsurEntBasic.industry
			this.isPad = getApp().globalData.isPad
		},
		mounted() {
			this.isPad = getApp().globalData.isPad
			//获取返显数据
			setTimeout(()=>{    
				//数据反显
				this.loanType = getApp().globalData.stdOffsurBaiscInfo.loanType
				this.form.sceneType = getApp().globalData.stdOffsurBaiscInfo.sceneType
				this.form.reportForm = getApp().globalData.stdOffsurBaiscInfo.statementType
				if(getApp().globalData.stdOffsurBaiscInfo.appluserType==1){
					this.applyDisabled = false //自然人禁用
				}else{
					this.applyDisabled = true
				}
				
				
			},getApp().globalData.timeout)
		},
		methods:{
			saveCache(e){//触发缓存
			  console.log(e)
			  this.$emit('saveCache',true)
			},
			//场景一同步合作方
			putPid(e){
				this.Pid = e	
			},
			
			sceneTypeChange(o){
				
				this.form.sceneType=o.detail.value
				
				if(this.form.sceneType==1){
					getApp().globalData.stdOffsurEntBasic.industry = '04'
				}else if(this.form.sceneType==2){
					getApp().globalData.stdOffsurEntBasic.industry = '01'
				}else if(this.form.sceneType==3){
					getApp().globalData.stdOffsurEntBasic.industry = '03'
				}
				//console.log(getApp().globalData.enterpriseInfo.industry)
				console.log(o)
				
				this.$emit('sceneTypeChange',o.detail.value)
					
			},
			
		
		}
		
		
			
	}
</script>

<style lang="scss">
	.header{
		height: 20rem;
		display: flex;
		flex-direction: row;
		font-size: 2.8rem;
		padding: 4rem 3rem;
		box-sizing: border-box;
		.radio{
			margin-right: 4rem;

		}
	}
</style>
